//
//  LeKeyFobService.h
//
//
//  Created by  on 2019/2/18.
//  Copyright © 2019 . All rights reserved.
//  连接的蓝牙设备操作

#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import <UIKit/UIKit.h>
#import "SROTADefines.h"
#import "CADeviceInfo.h"
#import "CAHistoryDataSR03.h"

#import "CARingSDK.h"
#import "CASDKConstant.h"
#import "CAEcgData.h"
#import "CAEcgAlgorithmResults.h"
#import "CAnAlgGrandActivity.h"
#import "CAnAlgRealMeasure.h"
#import "CAnAlgRltExerData.h"


@class CABLeService;
@class SRPacket;


/****************************************************************************/
/*						Temperature Alarm service.                          */
/****************************************************************************/
@interface CABLeService : NSObject


/* Querying Sensor */
@property (readonly) CBPeripheral *peripheral;
@property (assign, readonly) CGFloat battery;
@property (assign, nonatomic) BOOL isAlerting;
@property (strong, nonatomic)NSNumber *rssi; // 信号强度 负数
@property (assign, nonatomic) BOOL isManualDisconnect;      //标记用户手动断开
@property (assign, nonatomic) BOOL isExceptional;           //异常断开
@property (assign, nonatomic) NSInteger reconnectCounts;    //重连次数
@property (strong, nonatomic)NSString *advDataLocalName;    //外设本地名称
@property (strong, nonatomic)NSString *macAddress;

@property (assign, nonatomic)uint16_t cid;

@property(assign, nonatomic)CA_DEV_COLOR deviceColor; // 设备颜色
@property(assign, nonatomic)int deviceSize;  // 设备尺寸

@property(assign, nonatomic)NSUInteger deviceGeneration;  // 迭代版本

@property(assign, nonatomic)BOOL needOemAuth; //是否需要oem厂家认证
@property(strong, nonatomic)NSString *snString;
@property(strong, nonatomic)NSData *authSnData; // 认证使用sn data
@property(strong, nonatomic)NSString * softWareVersion;

@property(assign, nonatomic) BOOL hasBeenAuth; // 标记已认证过,无论是否通过认证都是YES

@property(strong, nonatomic)NSNumber *isWirenessCharge; //是否无线充电

@property(assign, nonatomic)BOOL isBinded;
@property(assign, nonatomic)BOOL isSupportSportMode;
@property(strong, nonatomic)NSNumber *chargeType;// 充电模式

@property(strong, nonatomic)NSNumber *scanIsCharge, *scanBatteryLevel;

@property(assign, nonatomic)BOOL isSupportEcg;
@property(assign, nonatomic)NSUInteger projectId;
@property(assign, nonatomic)BOOL isCharging;


- (instancetype) initWithPeripheral:(CBPeripheral *)peripheral;

//- (id) initWithPeripheral:(CBPeripheral *)peripheral controller:(id<StLeKeyFobProtocol>)delegate;
- (void) reset;
- (void) start;
- (void) stopRssiTimer;
-(void)setAdvData:(NSDictionary *)advertisementData;

-(BOOL)isConnected;



@end
